package com.game.share;

public class IOPackage {
	
	public static final IOPackage EMPRY_REQUEST = new IOPackage(PackageType.REQUEST,new byte[0]);
	public static final IOPackage EMPRY_RESPONSE = new IOPackage(PackageType.RESPONSE,new byte[0]);
	
	public enum PackageType {
		REQUEST {
			public int value() {
				return 0;
			}
		},
		RESPONSE {
			public int value() {
				return 1;
			}
		};
		public int value() {
			return 0;
		}
	}
	
	public static PackageType getPackageType(int type) {
		switch (type) {
		case 0:
			return PackageType.REQUEST;
		case 1:
			return PackageType.RESPONSE;
		}
		return null;
	}

	public IOPackage(PackageType type, byte[] data) {
		this.type = type;
		this.data = data;
	}

	public byte[] getData() {
		return data;
	}

	public PackageType getType() {
		return type;
	}
	
	private final PackageType type;
	private final byte[] data;
}
